import { createRouter, createWebHistory } from "vue-router";

const routes = [
    { path: '/', redirect: '/studentLogin' },
    {
        path: '/manager', meta: { title: '父级页面' }, component: () => import('../views/system/Manager.vue'),
        children: [
            { path: 'home', name: 'home', meta: { title: '系统主页' }, component: () => import('@/views/system/Home.vue') },
            { path: 'sysadmin', name: 'sysadmin', meta: { title: '系统管理员管理' }, component: () => import('@/views/sys_admin/SysAdmin.vue') },
            { path: 'admin', name: 'admin', meta: { title: '院管理员管理' }, component: () => import('@/views/college_admin/Admin.vue') },
            { path: 'student', name: 'student', meta: { title: '学生管理' }, component: () => import('@/views/student/Student.vue') },
            { path: 'teacher', name: 'teacher', meta: { title: '教师管理' }, component: () => import('@/views/teacher/Teacher.vue') },
            { path: 'password', name: 'password', meta: { title: '修改密码' }, component: () => import('@/views/system/Password.vue') },
            { path: 'activeType', name: 'activeType', meta: { title: '创新创业分类管理' }, component: () => import('@/views/college_admin/ActiveType.vue') },
            { path: 'grade', name: 'grade', meta: { title: '年级信息' }, component: () => import('@/views/college_admin/Grade.vue') },
            { path: 'speciality', name: 'speciality', meta: { title: '专业信息' }, component: () => import('@/views/college_admin/Speciality.vue') },
            { path: 'classes', name: 'classes', meta: { title: '班级信息' }, component: () => import('@/views/college_admin/Classes.vue') },
            { path: 'college', name: 'college', meta: { title: '学院信息' }, component: () => import('@/views/college_admin/College.vue') },
            { path: 'activeCredit', name: 'activeCredit', meta: { title: '创新创业活动管理' }, component: () => import('@/views/college_admin/ActiveCredit.vue') },
            { path: 'sysPerson', name: 'sysPerson', meta: { title: '系统管理员个人资料' }, component: () => import('@/views/system/person/SysPerson.vue') },
            { path: 'collegePerson', name: 'collegePerson', meta: { title: '院管理员个人资料' }, component: () => import('@/views/system/person/CollegePerson.vue') },
            { path: 'tPerson', name: 'tPerson', meta: { title: '教师个人资料' }, component: () => import('@/views/system/person/TeacherPerson.vue') },
            { path: 'sPerson', name: 'sPerson', meta: { title: '学生个人资料' }, component: () => import('@/views/system/person/StudentPerson.vue') },
            { path: 'sApply', name: 'sApply', meta: { title: '学分认证申请' }, component: () => import('@/views/student/SApply.vue') },
            { path: 'notice', name: 'notice', meta: { title: '公告通知' }, component: () => import('@/views/college_admin/Notice.vue') },
            { path: 'first', name: 'waitFirst', meta: { title: '待初审记录' }, component: () => import('@/views/teacher/WaitFirst.vue') },
            { path: 'firstRecord', name: 'FirstRecord', meta: { title: '已初审记录' }, component: () => import('@/views/teacher/FirstRecord.vue') },
            { path: 'end', name: 'end', meta: { title: '待终审记录' }, component: () => import('@/views/college_admin/WaitEnd.vue') },
            { path: 'endRecord', name: 'endRecord', meta: { title: '已终审记录' }, component: () => import('@/views/college_admin/EndRecord.vue') },
            { path: 'record', name: 'record', meta: { title: '待分配记录' }, component: () => import('@/views/college_admin/WaItGiven.vue') },
            { path: 'given', name: 'given', meta: { title: '已分配记录' }, component: () => import('@/views/college_admin/GivenRecord.vue') },
            { path: 'sysData', name: 'sysData', meta: { title: '系统数据统计' }, component: () => import('@/views/sys_admin/SysData.vue') },
            { path: 'collegeData', name: 'collegeData', meta: { title: '院数据统计' }, component: () => import('@/views/college_admin/CollegeData.vue') },
            { path: 'sApplyRecord', name: 'sApplyRecord', meta: { title: '学分申请记录' }, component: () => import('@/views/student/StudentApplyRecord.vue') },

        ]
    },
    { path: '/adminLogin', name: 'adminlogin', meta: { title: '管理员登录页面' }, component: () => import('../views/system/AdminLogin.vue') },
    { path: '/studentLogin', name: 'stulogin', meta: { title: '学生登录页面' }, component: () => import('../views/system/StudentLogin.vue') },
    /*{path: '/register', name: 'register', meta:{ title:'欢迎注册'}, component: () => import('../views/Register.vue')},*/

    { path: '/404', name: 'NotFound', meta: { title: '404找不到页面' }, component: () => import('../views/system/404.vue') },
    { path: '/:pathMatch(.*)', redirect: '/404' }

]

const router = createRouter({
    history: createWebHistory(),
    routes
})

router.beforeEach((to, from, next) => {
    //设置即将跳转的路由页面的网页标题
    document.title = to.meta.title
    next() //必须调用的方法
})

export default router